function muti(num) {
  return new Promise(resolve => {
    setTimeout(() => {
      resolve(num*num)
    }, 1000);
  })
}

const  nums =  [1,2,4]

// nums.forEach(async (i) => { //for in 同步循环
//   const res = await muti(i)
//   console.log(res);
// })

!(async function() { //for of 异步循环
  for(let i of nums) {
    const res = await muti(i)
    console.log(res);
  }
})()
